unit uniRelFichaTecnica;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QRCtrls, QuickRpt, ExtCtrls, jpeg, DB, ADODB;

type
  TfrmRelFichaTecnica = class(TForm)
    qrpRel: TQuickRep;
    QRBand1: TQRBand;
    QRShape21: TQRShape;
    QRLabel2: TQRLabel;
    qrlData: TQRLabel;
    QRLabel1: TQRLabel;
    QRLabel3: TQRLabel;
    qrlMarca: TQRLabel;
    QRLabel5: TQRLabel;
    qrlRepresentante: TQRLabel;
    qrlDesigner: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    qrlTamanho: TQRLabel;
    qrlMat1: TQRLabel;
    qrlCliente: TQRLabel;
    Cor1: TQRLabel;
    qrlMat2: TQRLabel;
    Cor2: TQRLabel;
    qrlMat3: TQRLabel;
    Cor3: TQRLabel;
    qrlMat5: TQRLabel;
    Cor5: TQRLabel;
    qrlMat4: TQRLabel;
    Cor4: TQRLabel;
    QRLabel4: TQRLabel;
    qrlCkSim: TQRLabel;
    QRShape1: TQRShape;
    qrlCkNao: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel12: TQRLabel;
    qrlCorRelevo: TQRLabel;
    qrlQtdTotal: TQRLabel;
    QRLabel15: TQRLabel;
    QRShape2: TQRShape;
    QRLabel14: TQRLabel;
    qrImgCliente: TQRImage;
    QR_Rel: TADOQuery;
    DS_Rel: TDataSource;
    QRLabel13: TQRLabel;
    qrlPedido: TQRLabel;
    QRLabel16: TQRLabel;
    qrlProduto: TQRLabel;
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmRelFichaTecnica: TfrmRelFichaTecnica;

implementation

uses UniFuncoes;

{$R *.dfm}

procedure TfrmRelFichaTecnica.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  qrlData.Caption := QR_Rel.fieldbyname('data').AsString ;
  qrlMarca.Caption := QR_Rel.fieldbyname('marca').AsString ;
  qrlPedido.Caption := QR_Rel.fieldbyname('cd_pedido').AsString ;
  qrlDesigner.Caption := ' ';
  qrlRepresentante.Caption := QR_Rel.fieldbyname('representante').AsString;
  qrlCliente.Caption := QR_Rel.fieldbyname('cliente').AsString;
  qrlMat1.Caption := QR_Rel.fieldbyname('material1').AsString;
  qrlMat2.Caption := QR_Rel.fieldbyname('material2').AsString;
  qrlMat3.Caption := QR_Rel.fieldbyname('material3').AsString;
  qrlMat4.Caption := QR_Rel.fieldbyname('material4').AsString;
  qrlMat5.Caption := QR_Rel.fieldbyname('material5').AsString;
  Cor1.Caption := QR_Rel.fieldbyname('cor_silk1').AsString;
  Cor2.Caption := QR_Rel.fieldbyname('cor_silk2').AsString;
  Cor3.Caption := QR_Rel.fieldbyname('cor_silk3').AsString;
  Cor4.Caption := QR_Rel.fieldbyname('cor_silk4').AsString;
  Cor5.Caption := QR_Rel.fieldbyname('cor_silk5').AsString;
  qrlProduto.Caption := QR_Rel.fieldbyname('PROD').AsString;
  qrlTamanho.Caption := QR_Rel.fieldbyname('ds_tamanho').AsString;
  if QR_Rel.fieldbyname('sn_relevo').AsBoolean then
  begin
    qrlCkSim.Caption := 'X';
    qrlCkNao.Caption := ' ';
  end
  else
  begin
    qrlCkSim.Caption := ' ';
    qrlCkNao.Caption := 'X';
  end;
  qrlCorRelevo.Caption := QR_Rel.fieldbyname('ds_Cor_relevo').AsString;   
  qrlQtdTotal.Caption := formatarValorInteiro(QR_Rel.fieldbyname('qtd_total').AsString);
end;

end.

{SELECT P.DATA,
M.DESCRICAO AS MARCA,
R.NOME AS REPRESENTANTE,
C.RAZAO AS CLIENTE,
(SELECT M.DESCRICAO FROM TB_MATERIAL M1 WHERE M1.CD_MATERIAL = PP.CD_MATERIAL1) AS MATERIAL1,
(SELECT M.DESCRICAO FROM TB_MATERIAL M2 WHERE M2.CD_MATERIAL = PP.CD_MATERIAL2) AS MATERIAL2,
(SELECT M.DESCRICAO FROM TB_MATERIAL M3 WHERE M3.CD_MATERIAL = PP.CD_MATERIAL3) AS MATERIAL3,
(SELECT M.DESCRICAO FROM TB_MATERIAL M4 WHERE M4.CD_MATERIAL = PP.CD_MATERIAL4) AS MATERIAL4,
(SELECT M.DESCRICAO FROM TB_MATERIAL M5 WHERE M5.CD_MATERIAL = PP.CD_MATERIAL5) AS MATERIAL5,PP.cor_silk1,
PP.cor_silk1,
PP.cor_silk2,
PP.cor_silk3,
PP.cor_silk4,
PP.cor_silk5,
(SELECT DS_TAMANHO FROM TB_TAMANHO_PRODUTO T WHERE T.CD_TAMANHO_PRODUTO = PP.CD_TAMANHO_PRODUTO) AS DS_TAMANHO,
PP.SN_RELEVO


 
FROM TB_PEDIDO P, TB_MARCA M, TB_REPRESENTANTE R, TB_CLIENTE C, TB_PRODUTO_PEDIDO PP

WHERE P.CD_MARCA = M.CD_MARCA
AND R.CD_REPRESENTANTE = P.CD_REPRESENTANTE
AND C.CD_CLIENTE = P.CD_CLIENTE
AND PP.CD_PEDIDO = P.CD_PEDIDO
}
